Visual Basic 2010 Listbox Error [migrated]

Posted by stargaze07 on Programmers See other posts from Programmers or by stargaze07
Published on 2012-10-15T05:10:34Z Indexed on 2012/10/15 9:49 UTC
Read the original article Hit count: 184

Filed under:

what is the meaning of this error? sorry it's my first time to use Visual basic 2010, I'm not familiar with this kind of error, I use this for selecting all the files in the listbox and tried to move or copy to another listbox in other form.

Error 1 'ToArray' is not a member of 'System.Windows.Forms.ListBox.ObjectCollection'.

This is the code I use.

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If RadioButton1.Checked Then

        Dim itemsToMove = ListBox1.Items.ToArray()
        For Each item In itemsToMove
            Form2.lstP.Items.Add(item)
            ListBox1.Items.Remove(item)
        Next
        Form2.Show()
    End If

End Sub

Can someone help me with this?

© Programmers or respective owner

Related posts about visual-studio-2010